﻿Public Class Form1

    Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown


        ' Start a drag.
        'PictureBox1.DoDragDrop(Label1.Text, DragDropEffects.All)

        Dim L_FileParam As String() = {Label1.Text} 'è fondamentale che sia un'array di stringhe!!!

        Dim dto As DataObject = New DataObject(DataFormats.FileDrop, L_FileParam)
        DoDragDrop(dto, DragDropEffects.Copy)


    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TextBox1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter

        If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
            e.Effect = DragDropEffects.Copy
        Else
            e.Effect = DragDropEffects.None
        End If

    End Sub

    Private Sub TextBox1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop
        Dim a As String()
        a = e.Data.GetData(DataFormats.FileDrop)
        'Debug.Print(a(0))
        TextBox1.Text = a(0)
    End Sub
End Class
